3.2.88 \(\int \cot (e+f x) (a+b \tan ^2(e+f x)) \, dx\) [188]

Optimal. Leaf size=26 \[ -\frac {b \log (\cos (e+f x))}{f}+\frac {a \log (\sin (e+f x))}{f} \]

[Out]

-b*ln(cos(f*x+e))/f+a*ln(sin(f*x+e))/f

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 26, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3706, 3556} \begin {gather*} \frac {a \log (\sin (e+f x))}{f}-\frac {b \log (\cos (e+f x))}{f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[e + f*x]*(a + b*Tan[e + f*x]^2),x]

[Out]

-((b*Log[Cos[e + f*x]])/f) + (a*Log[Sin[e + f*x]])/f

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3706

Int[((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2)/tan[(e_.) + (f_.)*(x_)], x_Symbol] :> Dist[A, Int[1/Tan[e + f*x],
 x], x] + Dist[C, Int[Tan[e + f*x], x], x] /; FreeQ[{e, f, A, C}, x] && NeQ[A, C]

Rubi steps

\begin {align*} \int \cot (e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx &=a \int \cot (e+f x) \, dx+b \int \tan (e+f x) \, dx\\ &=-\frac {b \log (\cos (e+f x))}{f}+\frac {a \log (\sin (e+f x))}{f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.03, size = 34, normalized size = 1.31 \begin {gather*} -\frac {b \log (\cos (e+f x))}{f}+\frac {a (\log (\cos (e+f x))+\log (\tan (e+f x)))}{f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[e + f*x]*(a + b*Tan[e + f*x]^2),x]

[Out]

-((b*Log[Cos[e + f*x]])/f) + (a*(Log[Cos[e + f*x]] + Log[Tan[e + f*x]]))/f

________________________________________________________________________________________

Maple [A]
time = 0.13, size = 25, normalized size = 0.96

method result size
derivativedivides \(\frac {-b \ln \left (\cos \left (f x +e \right )\right )+a \ln \left (\sin \left (f x +e \right )\right )}{f}\) \(25\)
default \(\frac {-b \ln \left (\cos \left (f x +e \right )\right )+a \ln \left (\sin \left (f x +e \right )\right )}{f}\) \(25\)
norman \(\frac {a \ln \left (\tan \left (f x +e \right )\right )}{f}-\frac {\left (a -b \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}\) \(35\)
risch \(-i x a +i x b -\frac {2 i a e}{f}+\frac {2 i b e}{f}+\frac {a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b}{f}\) \(63\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(f*x+e)*(a+b*tan(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/f*(-b*ln(cos(f*x+e))+a*ln(sin(f*x+e)))

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 33, normalized size = 1.27 \begin {gather*} -\frac {b \log \left (\sin \left (f x + e\right )^{2} - 1\right ) - a \log \left (\sin \left (f x + e\right )^{2}\right )}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

-1/2*(b*log(sin(f*x + e)^2 - 1) - a*log(sin(f*x + e)^2))/f

________________________________________________________________________________________

Fricas [A]
time = 3.06, size = 49, normalized size = 1.88 \begin {gather*} \frac {a \log \left (\frac {\tan \left (f x + e\right )^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - b \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

1/2*(a*log(tan(f*x + e)^2/(tan(f*x + e)^2 + 1)) - b*log(1/(tan(f*x + e)^2 + 1)))/f

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 58 vs. \(2 (22) = 44\).
time = 0.21, size = 58, normalized size = 2.23 \begin {gather*} \begin {cases} - \frac {a \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {a \log {\left (\tan {\left (e + f x \right )} \right )}}{f} + \frac {b \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} & \text {for}\: f \neq 0 \\x \left (a + b \tan ^{2}{\left (e \right )}\right ) \cot {\left (e \right )} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)**2),x)

[Out]

Piecewise((-a*log(tan(e + f*x)**2 + 1)/(2*f) + a*log(tan(e + f*x))/f + b*log(tan(e + f*x)**2 + 1)/(2*f), Ne(f,
 0)), (x*(a + b*tan(e)**2)*cot(e), True))

________________________________________________________________________________________

Giac [A]
time = 0.65, size = 34, normalized size = 1.31 \begin {gather*} \frac {a \log \left (\sin \left (f x + e\right )^{2}\right ) - b \log \left ({\left | \sin \left (f x + e\right )^{2} - 1 \right |}\right )}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(f*x+e)*(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

1/2*(a*log(sin(f*x + e)^2) - b*log(abs(sin(f*x + e)^2 - 1)))/f

________________________________________________________________________________________

Mupad [B]
time = 11.66, size = 36, normalized size = 1.38 \begin {gather*} \frac {a\,\ln \left (\mathrm {tan}\left (e+f\,x\right )\right )}{f}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {a}{2}-\frac {b}{2}\right )}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(e + f*x)*(a + b*tan(e + f*x)^2),x)

[Out]

(a*log(tan(e + f*x)))/f - (log(tan(e + f*x)^2 + 1)*(a/2 - b/2))/f

________________________________________________________________________________________